<?php
require '../../common.inc.php';
include("xcxpay.class.php");
$paymodule = new xcxPayClass('wx6465a42f23863ec1', '6b93b437a7d8f3d9f6ceeac4cfb0ed4f', '1601180869', '83ce17342a92b23d70d7e5876f9907b1');

// 小程序支付
if($action == "pay")
{
	$r = $db->get_one("SELECT * FROM {$DT_PRE}finance_charge WHERE itemid='".$orderid."'");
	if($r)
	{
		$order = array();
		$order['openid'] = $openid;
		$order['orderid'] = $r['itemid'];
		$order['price'] = $r['amount'] + $r['fee'];
		$order['title'] = '巨匠-匠豆充值';
		$paymodule->pay($order);
	}else{
		$data['state'] = 0;
		$data['text'] = "错误";
		echo json_encode($data);
	}
}
?>